var t = getApp();

Page({
    data: {
        detail: {},
        popup: !1,
        pay_id: 0,
        order: [],
        diyform: {
            form_id: "",
            diyform_data_id: "",
            pre_id: ""
        },
        profitShow: !1,
        withdrawal: !1
    },
    onLoad: function(t) {
        t.pay_id && (this.setData({
            pay_id: t.pay_id
        }), this.getData());
    },
    getData: function() {
        var a = this, i = t.getNetAddresss("plugin.consumer-reward.frontend.controllers.payment-jump.index");
        t._getNetWork({
            url: i,
            data: {
                pay_id: this.data.pay_id
            },
            success: function(i) {
                var d = i.data;
                if (1 != d.result) return t.tips(d.msg);
                var e = !1;
                1 == d.data.popup && (e = !0), a.setData({
                    detail: d.data,
                    order: d.data.order,
                    popup: e
                });
            }
        });
    },
    receive: function() {
        var a = this, i = t.getNetAddresss("plugin.consumer-reward.frontend.controllers.reward.receive-reward");
        t._getNetWork({
            url: i,
            data: {
                pay_id: this.data.pay_id
            },
            success: function(i) {
                var d = i.data;
                t.tips(d.msg), 1 == d.result && setTimeout(function() {
                    1 == a.data.detail.is_withdraw ? 1 == a.data.detail.is_bind && a.setData({
                        popup: !1,
                        withdrawal: !0,
                        "diyform.form_id": d.data.form_id,
                        networkLoading: !0,
                        is_form: d.data.is_form,
                        cash: d.data.cash,
                        dividend_id: d.data.dividend_id
                    }) : wx.navigateTo({
                        url: "/packageG/member_v2/member_v2"
                    });
                }, 1e3);
            }
        });
    },
    handWithBtn: function() {
        this.sendBtn();
    },
    traCheckedData: function(t) {
        var a = t.detail.diyform_data_id;
        console.log(t), a && this.sendBtn(a);
    },
    setProfitShow: function() {
        this.setData({
            profitShow: !this.data.profitShow
        });
    },
    sendBtn: function() {
        var a = this, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, d = {
            form_data_id: i,
            form_id: this.data.diyform.form_id,
            dividend_id: this.data.dividend_id,
            cash: this.data.cash
        }, e = t.getNetAddresss("plugin.consumer-reward.frontend.controllers.withdraw.withdraw");
        t._getNetWork({
            url: e,
            data: d,
            success: function(i) {
                var d = i.data;
                t.tips(d.msg), 1 == d.result && a.setData({
                    withdrawal: !1,
                    profitShow: !1
                });
            }
        });
    },
    gotoBannerUrl: function() {
        wx.navigateTo({
            url: this.data.detail.min_link
        });
    },
    setPopup: function() {
        this.setData({
            popup: !this.data.popup
        });
    },
    setWithdrawal: function() {
        this.setData({
            withdrawal: !this.data.withdrawal
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});